package com.wzcl.app.dao.model;


import com.wzcl.app.dao.model.common.Base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@Entity
@Table(name = "ActivityGroup")
@ApiModel(value = "活动团")
@EntityListeners(AuditingEntityListener.class)
public class ActivityGroup implements Base {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ApiModelProperty(value = "活动Id")
    private Integer activityId;

    @ApiModelProperty(value = "商品Id")
    private Integer commodityId;

    @ApiModelProperty(value = "优惠id")
    private Integer promotionId;

    @CreatedDate
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "过期时间")
    private Date expiredTime;

    @ApiModelProperty(value = "团长电话")
    private String userPhone;

    @ApiModelProperty(value = "姓名")
    private String userName;

    @ApiModelProperty(value = "头像的文件ID")
    private String headIcon;

    @ApiModelProperty(value = "当前人数")
    private Integer size;

    @ApiModelProperty(value = "最大人数")
    private Integer max;

    @ApiModelProperty(value = "团的状态")
    private Integer groupState;

    @ElementCollection
    @CollectionTable(name = "GROUP_MEMBER",
            joinColumns = @JoinColumn(name = "activityGroupId", referencedColumnName = "id"))
    @Column(name = "member")
    private List<String> members = new ArrayList<String>();

    public Integer getId() {
        return id;
    }

    public Integer getActivityId() {
        return activityId;
    }

    public Integer getCommodityId() {
        return commodityId;
    }

    public Integer getPromotionId() {
        return promotionId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public Date getExpiredTime() {
        return expiredTime;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public String getUserName() {
        return userName;
    }

    public String getHeadIcon() {
        return headIcon;
    }

    public Integer getSize() {
        return size;
    }

    public Integer getMax() {
        return max;
    }

    public Integer getGroupState() {
        return groupState;
    }

    public List<String> getMembers() {
        return members;
    }
}
